// SKU模块接口管理
import request from "@/utils/request"
import type { SkuListResponseData, SkuInfoResponseData } from "./type"
// 枚举地址
enum API {
   // 获取已有商品的数据-SKU
   SKULIST_URL = '/admin/product/list/',
   // 上架商品
   ONSALE_URL = '/admin/product/onSale/',
   // 下架商品
   CANCLESALE_URL = '/admin/product/cancelSale/',
   // 获取某一个sku的详细信息
   SKUINFO_URL = '/admin/product/getSkuInfo/',
   // 删除某一个sku
   DELETESKU_URL = '/admin/product/deleteSku/'
}

// 获取商品sku的请求
export const reqSkuList = (page: number, limit: number) => request.get<any, SkuListResponseData>(API.SKULIST_URL + `${page}/${limit}`)
// 已有商品上架的请求
export const reqSkuOnSale = (skuId: number) => request.get<any, any>(API.ONSALE_URL + skuId)
// 已有商品下架的请求
export const reqSkuCancelSale = (skuId: number) => request.get<any, any>(API.CANCLESALE_URL + skuId)
// 获取sku详细信息
export const reqSkuInfo = (skuId: number) => request.get<any, SkuInfoResponseData>(API.SKUINFO_URL + skuId)
// 删除一个sku的请求
export const reqDeleteSku = (skuId: number) => request.delete<any, any>(API.DELETESKU_URL + skuId)